Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Encode and decode base64 strings.
Install with npm
npm install libbase64
Require in your script
var libbase64 = require('libbase64');
Encode Buffer objects or unicode strings with
libbase64.encode(val) → String
Where
Example
libbase64.encode('jõgeva');
// asO1Z2V2YQ==
To enforce soft line breaks on lines longer than selected amount of characters, use wrap
libbase64.wrap(str[, lineLength]) → String
Where
Example
libbase64.wrap('asO1Z2V2asO1Z2V2asO1Z2V2YQ==', 10)
// asO1Z2V2as\r\n
// O1Z2V2asO1\r\n
// Z2V2YQ==
libbase64
makes it possible to encode and decode streams with libbase64.Encoder
and libbase64.Decoder
constructors.
Create new Encoder Stream with
var encoder = new libbase64.Encoder([options])
Where
lineLength
if you want to use any other line length than the default 76 characters (or set to false
to turn the soft wrapping off completely)Example
The following example script reads in a file, encodes it to base64 and saves the output to a file.
var libbase64 = require('libbase64');
var fs = require('fs');
var source = fs.createReadStream('source.txt');
var encoded = fs.createReadStream('encoded.txt');
var encoder = new libbase64.Encoder();
source.pipe(encoder).pipe(encoded);
Create new Decoder Stream with
var decoder = new libbase64.Decoder([options])
Where
Example
The following example script reads in a file in base64 encoding, decodes it and saves the output to a file.
var libbase64 = require('libbase64');
var fs = require('fs');
var encoded = fs.createReadStream('encoded.txt');
var dest = fs.createReadStream('dest.txt');
var decoder = new libbase64.Decoder();
encoded.pipe(decoder).pipe(dest);
MIT
FAQs
Encode and decode base64 encoded strings
The npm package libbase64 receives a total of 1,266,235 weekly downloads. As such, libbase64 popularity was classified as popular.
We found that libbase64 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.